package vn.edu.uit.chemistry.view;

import vn.edu.uit.chemistry.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

public class ViewRowGameShow extends AbstractView {

	TextView tvNhom;
	ProgressBar prPercent;
	TextView tvPercent;
	TextView tvFinish;
	
	public ViewRowGameShow(Context context) {
		super(context);
		pContext = context;
		mInflater = LayoutInflater.from(pContext);
		layout = mInflater.inflate(R.layout.row_game, null);
		
		tvNhom = (TextView) layout.findViewById(R.id.tvNhom);
		tvFinish = (TextView) layout.findViewById(R.id.tvFinish);
		tvPercent = (TextView) layout.findViewById(R.id.tvPercent);
		prPercent = (ProgressBar) layout.findViewById(R.id.prPercent);
	}
	
	public void setContent(String ten, String result) {
		tvNhom.setText("Tên nhóm: "+ten);
		if (result.equals("0")) {
			tvPercent.setVisibility(View.VISIBLE);
			prPercent.setVisibility(View.VISIBLE);
			tvFinish.setVisibility(View.GONE);
		} else {
			tvPercent.setVisibility(View.GONE);
			prPercent.setVisibility(View.GONE);
			tvFinish.setVisibility(View.VISIBLE);
			tvFinish.setText("Hoàn tất: " + result);
		}
	}

}
